// 目标最优值
<template>
  <div class="tableAuto">
    <el-table :data="tableData" style="width:100%" :height="height" @row-click="rowClick" border stripe
      :header-cell-style="{background:'#EAEBEC'}" v-loading="tableLoading" ref="refTable" highlight-current-row @sort-change='sortChange'>
      <el-table-column prop="mbx" min-width="160" show-overflow-tooltip label="目标名称"></el-table-column>
      <el-table-column prop="zyjlx" width="220" show-overflow-tooltip label="最优解类型"></el-table-column>
      <el-table-column prop="cppmc" width="250" show-overflow-tooltip label="最优解"></el-table-column>
      <el-table-column prop="xiaxian" width="160" show-overflow-tooltip label="下限"></el-table-column>
      <el-table-column prop="shangxian" width="160" show-overflow-tooltip label="上限"></el-table-column>
    </el-table>
  </div>
</template>
<script>
export default {
  data () {
    return {
      radioId: "",
      height: document.body.offsetHeight - 210,

      wrList: [{
        label: "读写",
        value: 0
      }, {
        label: "只读",
        value: 1
      }, {
        label: "只写",
        value: 2
      }],
      tableData: [
        { 'mbx': '水分含量', 'zyjlx': '最小值', 'cppmc': '温度', 'xiaxian': '55', 'shangxian': '55', },
        { 'mbx': '水分含量', 'zyjlx': '最小值', 'cppmc': '喂料量', 'xiaxian': '1.0000026', 'shangxian': '55', },
        { 'mbx': '水分含量', 'zyjlx': '最小值', 'cppmc': '风速', 'xiaxian': '0.3', 'shangxian': '55', },
        { 'mbx': '水分含量', 'zyjlx': '最小值', 'cppmc': '振动频率', 'xiaxian': '42', 'shangxian': '55', },
        { 'mbx': '水分含量', 'zyjlx': '最小值', 'cppmc': '振动频率', 'xiaxian': '42', 'shangxian': '55', },
      ],
    }
  },
  props: {
    // tableData: Array,
    pager: Object,
    tableLoading: Boolean
  },
  methods: {
    rowClick (row) {
      this.radioId = row.woId;
      let obj = {
        row: row,
        radioId: this.radioId,
      }
      this.$emit("handleEdit", obj)
      this.$refs.refTable.setCurrentRow(row);
    },
    sortChange (column) {
      this.$emit('sortChange', column)
    },
    table_index (index) {
      return (this.pager.pageNum - 1) * this.pager.pageSize + index
    },
    getwrName (id) {
      if (!id && id !== 0) return ''
      return this.wrList.find(item => parseInt(item.value) == id).label
    },

  }
}
</script>
<style scoped>
.bai {
  color: #fff;
}
.tableAuto {
  margin-top: 10px;
}
</style>